Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
JavaScript Implementing "change" Event for WooCommerce Cart

Dear everyone,

I am trying to add eventListeners to my WordPress/WooCommerce Cart so that it changes the pricing on input change. Simple in theory.

The webpage (please put item in cart and go to cart): www.dickenbergh.com

My current test code:

<script type="text/javascript">

document.getElementsByTagName('input')[0].addEventListener('change', updatePricing);

function updatePricing(){
    document.getElementsByTagName('bdi')[2].innerHTML = '999 changed';
}

</script>

Problem:

The change only happens when typing into the input field. Not when changing it with the - and + buttons around it.

Question:

Why does it only change upon actually changing the input of the field by typing? Should the "change" event not also register the button changes on the - and + arrow?

almost 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I've checked the reference you provided. And at https://dickenbergh.com/cart/ the total price changes when we click on update, no matter change the value by +.- button or by typing manually.

So, the problem you described is working fine, I think. But I'll advice you to use ajax to automatically update the total price so you don't need that update button to change total price.

Or you can simply add update function to that change listener so that total price gets updated automatically without the need of that button.

Thanks.

almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda